package com.kkd.kkdapp.db;

import com.kkd.kkdapp.Environment;
import com.kkd.kkdapp.db.app.model.User;
import com.kkd.kkdapp.db.user.model.UserInfo;

public class CurUserModel {
	private static User mUser;
	private static UserInfo mMyInfo;

	public static User getCurUser() {
		mUser = User.getCurUser();
		return mUser;
	}

	public static UserInfo getMyInfo() {
		if (getCurUser() != null){
			mMyInfo = UserInfo.queryUserInfoByCid(getCurUser().customerId);
			if(mMyInfo==null){
				mMyInfo = new UserInfo();
				mMyInfo.init(mUser);
				mMyInfo.isShowedAsses = -1;
				mMyInfo.isSurved = -1;
				mMyInfo.survedUrl = Environment.getH5Url()+"assessment.html?isPost=true&isLogin=true";
				UserInfo.insertOrUpdate(mMyInfo);
			}
		}
		return mMyInfo;
	}

	public static UserInfo reSetMyInfo() {
		mMyInfo = UserInfo.queryUserInfoByCid(getCurUser().customerId);
		return mMyInfo;
	}

	public static void cancelCurUser() {
		
		User.delCurUser();
		mUser = null;
		mMyInfo = null;
	}

}
